<?php
namespace app\serverintegralmall\validate;
use \app\manage\validate\BaseValidate;

class Goods extends BaseValidate
{
    //添加和编辑的时候的验证规则
	protected $rule =   [
        'id'  => ['integer','gt'=>0],
        'user_id'  => ['integer','gt'=>0],
        'cate_id'  => ['integer','gt'=>0],
        'title'    => ['length'=>'2,25'],
        'product_code' => ['min'=>'10'],
    	'imgs_urls'=> ['min'=>'1'],
        'imgs_ids' => ['min'=>'1'],
    	'desc' => ['min'=>'2'],
        'integral'=> ['integer','gt'=>0],
        'number'=> ['integer','gt'=>0],
        'origin_number'=> ['integer','gt'=>0],
        'order'=> ['integer','egt'=>0],
        'operate_uid'=> ['integer','gt'=>0],
        'page'=>['integer','gt'=>0],
        'listRows'=>['integer','gt'=>0,'elt'=>50],
    ];

    protected $message  =   [
    ];

    //上面必须包含以下字段，否则无效
    protected $scene = [
        /*管理员操作单个商品时的验证*/
        'manageOperaGoods' => ['id','app_id'],
        /*管理员批量操作商品时的验证*/
        'manageBatchOperaGoods' => [
            'id'  => ['require','array','min'=>1],
            'app_id'
        ],
        /*管理员批量审核商品*/
        'manageBatchAuditGoods' => [
            'id'  => ['require','array','min'=>1],
            'status' => ['require','in'=>'1,2'],
            'app_id'
        ],
        /*管理员批量下架商品*/
        'manageBatchSoldOutGoods' => [
            'id'  => ['require','array','min'=>1],
            'app_id'
        ],
    ];


}